Conversation
* Move envBasePath into ssrParameters * Apply MRT restrictions on supported base paths * Update changelogs * one more changelog * Update express.test.js * Remove whitespace trimming * Remove test base path * Add comment
✅ Snyk checks have passed. No issues have been found so far.
💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse. |
* Add base path to react router routes * Handle basename for urls that bypass react router * Add a feature toggle for app base names * Add tests * Update config templates * Rename getBasename to getRouterBasePath * Update changelogs * Test fixes * Remove unused import and cleanup comments * Apply suggestions * Clean up redundant code
Signed-off-by: vcua-mobify <47404250+vcua-mobify@users.noreply.github.com>
Signed-off-by: vcua-mobify <47404250+vcua-mobify@users.noreply.github.com>
Signed-off-by: vcua-mobify <47404250+vcua-mobify@users.noreply.github.com>
…ed urls (#3666) * Address base path duplication * Update CHANGELOG.md * Update CHANGELOG.md * Update CHANGELOG.md * Apply suggestions * Fix unwanted basePath removal if base path is a substring * Lint * Add console warn
There was a problem hiding this comment.
Signed-off-by: vcua-mobify <47404250+vcua-mobify@users.noreply.github.com>
| history[action](path, ...args) | ||
| const basePath = getBasePath?.() ?? '' | ||
| const pathWithoutBase = removeBasePathFromLocation(path, basePath) | ||
| history[action](pathWithoutBase, ...args) |
There was a problem hiding this comment.
why do we need to exclude basePath in this navigate? (I probably missed the context of this)
There was a problem hiding this comment.
This change was a part of #3666 .
The history API is a part of react router so when it is invoked with a path, react router will automatically append the base path (set as the basename prop on the Router).
If we don't remove the base path, then react router will add a duplicate base path.
It's the same issue that we fixed in sf-next in this PR: https://github.com/commerce-emu/storefront-next/pull/1050
| ## v5.2.0-dev | ||
| - Update storefront preview to support base paths [#3666](https://github.com/SalesforceCommerceCloud/pwa-kit/pull/3666) | ||
|
|
||
| ## v5.1.0-dev |
There was a problem hiding this comment.
Two -dev versions? Does not seem right
There was a problem hiding this comment.
This was because 5.1.0-dev corresponds with 3.17.0. Since this is not aimed at the 3.17 release, it's a separate version.
| - Move envBasePath into ssrParameters [#3590](https://github.com/SalesforceCommerceCloud/pwa-kit/pull/3590) | ||
| - Support adding base paths to shopper facing URLs [#3615](https://github.com/SalesforceCommerceCloud/pwa-kit/pull/3615) | ||
|
|
||
| ## v3.17.0-dev |
There was a problem hiding this comment.
Why do we have two -dev changelog here?
There was a problem hiding this comment.
I'm getting a bit ahead of the versioning since 3.17.0 is now in preview. This change isn't making the 3.17 release so it's under a new version.
|
|
||
| useEffect(() => { | ||
| if (enabled && isHostTrusted) { | ||
| if (process.env.NODE_ENV !== 'production' && !getBasePath) { |
There was a problem hiding this comment.
nit: Add a guard to check if basePath is enabled showBasePath so we avoid printing the warning on all sites that don't use basePath
This feature branch contains the work for productizing base path prefixes in PWA and is the amalgamation of the following:
#3590 - Move envBasePath into ssrParameters
#3615 - Support adding base paths to shopper facing urls
#3666 - Storefront preview support / address base path duplication in preview url
Aside from the above 3 PRs, this PR contains an update to the Refresh component that was missed in #3666 .